package com.study.sbsummary.config.apollo;

import com.ctrip.framework.apollo.model.ConfigChangeEvent;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ApolloRefreshConfig {
    private static final Logger LOGGER = LoggerFactory.getLogger(ApolloRefreshConfig.class);

    @ApolloConfigChangeListener
    private void onChange(ConfigChangeEvent changeEvent) {
        changeHandler(changeEvent);
    }

    private void changeHandler(ConfigChangeEvent changeEvent) {
        for (String key : changeEvent.changedKeys()) {
            LOGGER.info("apollo key.getNewValue={}", changeEvent.getChange(key).getNewValue());
        }
    }
}
